package PeriodeMahasiswa;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import model.PengendaliMahasiswa;
import model.Yudisium;
import view.PanelUbahKelengkapan;

public class PeriodeMahasiswa extends JPanel {
    private JLabel labelPanel;
    private JLabel labelPeriodeBulan;
    private JTextField textPeriodeBulan;
    private JLabel labeltglawal;
    private JTextField texttglawal;
    private JLabel labeltglakhir;
    private JTextField textTanggalakhir;
    private JButton tombolProses;
    private JButton tombolBatal;

    public PeriodeMahasiswa() {

        setLayout(null);

        labelPanel = new JLabel ("Panel Cek Periode");
        labelPanel.setBounds(190, 15, 200, 40);
        add(labelPanel);

        labelPeriodeBulan=new JLabel("Bulan ");
        labelPeriodeBulan.setBounds(50, 120, 80, 20);
        this.add(labelPeriodeBulan);

        textPeriodeBulan=new JTextField();
        textPeriodeBulan.setBounds(130, 120, 200, 20);
        this.add(textPeriodeBulan);

        labeltglawal=new JLabel("Hari");
        labeltglawal.setBounds(50, 150, 80, 20);
        this.add(labeltglawal);

        texttglawal=new JTextField();
        texttglawal.setBounds(130, 150, 150, 20);
        this.add(texttglawal);

        labeltglakhir=new JLabel("Tanggal");
        labeltglakhir.setBounds(50, 180, 80, 20);
        this.add(labeltglakhir);

        textTanggalakhir=new JTextField();
        textTanggalakhir.setBounds(130, 180, 100, 20);
        this.add(textTanggalakhir);

        tombolProses = new JButton ("PROSES");
        tombolProses.setBounds(150, 230, 100, 20);
        add(tombolProses);
        
        tombolProses.addActionListener(new ActionListener () {
            @Override
            public void actionPerformed(ActionEvent e) {
                tombolProsesAction();
            }
        });
    }
   public void tombolProsesAction() {
        Yudisium test = new Yudisium();
        JDialog testFrame = new JDialog();
        test.setPeriode(textPeriodeBulan.getText());
        PanelUbahKelengkapan.bacaTabelYudisium(test);
        PanelUbahKelengkapan test1 = new PanelUbahKelengkapan(PengendaliMahasiswa.DAFTAR_MAHASISWA);
//        testFrame.getContentPane().add(test1);
        testFrame.setSize(1367, 765);
        testFrame.setVisible(true);
        testFrame.setTitle("Panel Periksa Yudisium");
    }
}
